<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WebServices
 *
 * @author pablo
 */
class WebServices {

    public static $host = "http://localhost/webservices/";
    public static $busca_mesa = "buscamesa.json.php";

    public static function obtener($mesa) {
        $usuario = exec('whoami');
        $letra = 0;
        $ws = file_get_contents(WebServices::$host . WebServices::$busca_mesa . "?mesa=$mesa&extranjero=$letra&usuario=$usuario");
        $resultado = json_decode($ws, TRUE);
        if ($resultado['codigo'] != 0)
            throw new Exception($resultado['mensaje']);
        return $resultado;
    }

}
